package com.ruoyi.web.controller.warning;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.warning.domain.entity.Threshold;
import com.ruoyi.warning.service.IThresholdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 阈值表 前端控制器
 * </p>
 *
 * @author chenhc
 * @since 2025-03-25
 */
@RestController
@RequestMapping("/threshold")
@Api(tags = "阈值", description = "用于处理 阈值 操作的控制器")
public class ThresholdController {
    @Resource
    private IThresholdService thresholdService;
    @ApiOperation("根据id获取所有阈值")
    @GetMapping(value = "/getAllThresholds/{deviceId}")
    public R getAllThresholds(@PathVariable Integer deviceId)
    {
        return R.ok(thresholdService.getAllThresholds(deviceId));
    }
    @ApiOperation("根据id修改阈值")
    @PostMapping(value = "/updateThresholds")
    public R updateThresholds(@RequestBody List<Threshold> list)
    {
        return R.ok(thresholdService.updateThresholds(list));
    }
}
